import { Injectable } from '@angular/core'
import { LocalStorageService } from '@/app/shared'
import { defaults } from '../settings'

export const USER_KEY = 'role'

export interface User {
  id?: number
  name?: string
  email?: string
  avatar?: string
}


@Injectable({
  providedIn: 'root'
})
export class SettingsService{
  private options =  defaults

  constructor(private store: LocalStorageService) {}

  get user(): object {
    return this.store.get(USER_KEY)
  }

  setUser(value: User): void {
    this.store.set(USER_KEY, value)
  }

  removeUser(): void {
    this.store.remove(USER_KEY)
  }
}
